﻿using dotHTML.HTML;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Text;
using System.Collections.Generic;
#pragma warning disable 0618
namespace TestdotHTML
{
    
    
    /// <summary>
    ///This is a test class for FormTest and is intended
    ///to contain all FormTest Unit Tests
    ///</summary>
    [TestClass()]
    public class FormTest {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext {
            get {
                return testContextInstance;
            }
            set {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///A test for Form Constructor
        ///</summary>
        [TestMethod()]
        public void FormConstructorTest() {
            Form target = new Form();
            Assert.AreEqual("<form></form>", target.ToString());
        }

        /// <summary>
        ///A test for Accept
        ///</summary>
        [TestMethod()]
        public void AcceptTest() {
            Form target = new Form();
            target.Accept.Add("ac1");
            target.Accept.Add("ac2");
            Assert.IsTrue(target.Accept.Count == 2);
            Assert.IsTrue(target.Accept.Contains("ac1"));
            Assert.IsTrue(target.Accept.Contains("ac2"));
        }

        /// <summary>
        ///A test for AcceptCharset
        ///</summary>
        [TestMethod()]
        public void AcceptCharsetTest() {
            Form target = new Form();
            target.AcceptCharset.Add("ac1");
            target.AcceptCharset.Add("ac2");
            Assert.IsTrue(target.AcceptCharset.Count == 2);
            Assert.IsTrue(target.AcceptCharset.Contains("ac1"));
            Assert.IsTrue(target.AcceptCharset.Contains("ac2"));
        }

        /// <summary>
        ///A test for Action
        ///</summary>
        [TestMethod()]
        public void ActionTest() {
            Form target = new Form();
            string expected = string.Empty;
            string actual;
            target.Action = expected;
            actual = target.Action;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for AutoComplete
        ///</summary>
        [TestMethod()]
        public void AutoCompleteTest() {
            Form target = new Form();
            Nullable<bool> expected = false;
            Nullable<bool> actual;
            target.AutoComplete = expected;
            actual = target.AutoComplete;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for EncType
        ///</summary>
        [TestMethod()]
        public void EncTypeTest() {
            Form target = new Form();
            string expected = string.Empty;
            string actual;
            target.EncType = expected;
            actual = target.EncType;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for Method
        ///</summary>
        [TestMethod()]
        public void MethodTest() {
            Form target = new Form();
            Nullable<FormMethodChoices> expected = FormMethodChoices.GET;
            Nullable<FormMethodChoices> actual;
            target.Method = expected;
            actual = target.Method;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for Name
        ///</summary>
        [TestMethod()]
        public void NameTest() {
            Form target = new Form();
            string expected = string.Empty;
            string actual;
            target.Name = expected;
            actual = target.Name;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for NoValidate
        ///</summary>
        [TestMethod()]
        public void NoValidateTest() {
            Form target = new Form();
            bool expected = false;
            bool actual;
            target.NoValidate = expected;
            actual = target.NoValidate;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for Target
        ///</summary>
        [TestMethod()]
        public void TargetTest() {
            Form target = new Form();
            string expected = string.Empty;
            string actual;
            target.Target = expected;
            actual = target.Target;
            Assert.AreEqual(expected, actual);
        }

        [TestMethod()]
        public void ToStringTest() {
            Form target = new Form();
            target.Accept.Add("ac1");
            target.Accept.Add("ac2");
            target.AcceptCharset.Add("ac3");
            target.AcceptCharset.Add("ac4");
            target.Action = "url";
            target.AutoComplete = true;
            target.EncType = "enctype";
            target.Method = FormMethodChoices.GET;
            target.NoValidate = true;
            target.Target = "target";
            Assert.AreEqual("<form accept=\"ac1,ac2,\" " +
                "accept-charset=\"ac3 ac4 \" " +
                "action=\"url\" " +
                "autocomplete=\"on\" " +
                "enctype=\"enctype\" " +
                "method=\"get\" " +
                "novalidate=\"novalidate\" " +
                "target=\"target\"></form>", target.ToString());
        }
    }
}
